package com.zzyl.nursing.member;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zzyl.common.constant.HttpStatus;
import com.zzyl.common.core.controller.BaseController;
import com.zzyl.common.core.domain.R;
import com.zzyl.common.core.page.TableDataInfo;
import com.zzyl.serve.domain.NursingProject;
import com.zzyl.serve.service.INursingProjectService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 老人家属Controller
 *
 * @author ruoyi
 * @date 2025-02-25
 */
@RestController
@RequestMapping("/member/orders/project")
@Api(tags = "订单相关接口")
public class FamilyOrdersController extends BaseController {
    @Autowired
    private INursingProjectService nursingProjectService;

    @GetMapping("/page")
    @ApiOperation("分页查询")
    public TableDataInfo<NursingProject> login(String name, Integer pageNum, Integer pageSize, @RequestParam(defaultValue ="1") Integer status) {
        Page login = nursingProjectService.pageNameStatus(name, pageNum, pageSize,  status);
        return getDataTable(login);
    }



    @GetMapping("/{id}")
    @ApiOperation("根据id查询详细信息")
    public R<NursingProject> login(@PathVariable("id") Long id) {
        return R.ok(nursingProjectService.selectNursingProjectById(id));

    }










    protected TableDataInfo<NursingProject> getDataTable(Page list) {
        TableDataInfo rspData = new TableDataInfo();
        rspData.setCode(HttpStatus.SUCCESS);
        rspData.setMsg("查询成功");
        rspData.setRows(list.getRecords());
        rspData.setTotal(list.getTotal());
        return rspData;
    }




}
